return 0;
}
+static void
+get_window_point_from_screen_point (GdkWindow *window,
+ NSPoint screen_point,
+ gint *x,
+ gint *y)
+{
+ NSPoint point;
+ NSWindow *nswindow;
+
+ nswindow = ((GdkWindowImplQuartz *)window->impl)->toplevel;
+
+ point = [nswindow convertScreenToBase:screen_point];
+
+ *x = point.x;
+ *y = window->height - point.y;
+}
+
static GdkEvent *
create_focus_event (GdkWindow *window,
gboolean in)
static void
generate_motion_event (GdkWindow *window)
{
- NSPoint point;
NSPoint screen_point;
- NSWindow *nswindow;
GdkEvent *event;
gint x, y, x_root, y_root;
event->any.window = NULL;
event->any.send_event = TRUE;
- nswindow = ((GdkWindowImplQuartz *)window->impl)->toplevel;
-
screen_point = [NSEvent mouseLocation];
_gdk_quartz_window_nspoint_to_gdk_xy (screen_point, &x_root, &y_root);
-
- point = [nswindow convertScreenToBase:screen_point];
-
- x = point.x;
- y = window->height - point.y;
+ get_window_point_from_screen_point (window, screen_point, &x, &y);
event->any.type = GDK_MOTION_NOTIFY;
event->motion.window = window;
void
_gdk_quartz_events_send_enter_notify_event (GdkWindow *window)
{
- NSPoint point;
NSPoint screen_point;
- NSWindow *nswindow;
GdkEvent *event;
gint x, y, x_root, y_root;
event->any.window = NULL;
event->any.send_event = FALSE;
- nswindow = ((GdkWindowImplQuartz *)window->impl)->toplevel;
-
screen_point = [NSEvent mouseLocation];
_gdk_quartz_window_nspoint_to_gdk_xy (screen_point, &x_root, &y_root);
-
- point = [nswindow convertScreenToBase:screen_point];
-
- x = point.x;
- y = window->height - point.y;
+ get_window_point_from_screen_point (window, screen_point, &x, &y);
event->crossing.window = window;
event->crossing.subwindow = NULL;
info = _gdk_display_get_pointer_info (display, display->core_pointer);
toplevel = info->toplevel_under_pointer;
if (toplevel && WINDOW_IS_TOPLEVEL (toplevel))
- {
- NSWindow *nswindow;
- NSPoint point;
-
- nswindow = ((GdkWindowImplQuartz *)toplevel->impl)->toplevel;
-
- point = [nswindow convertScreenToBase:screen_point];
-
- *x = point.x;
- *y = toplevel->height - point.y;
- }
+ get_window_point_from_screen_point (toplevel, screen_point, x, y);
return toplevel;
}
{
/* Finally check the grab window. */
GdkWindow *grab_toplevel;
- NSWindow *grab_nswindow;
grab_toplevel = gdk_window_get_effective_toplevel (grab->window);
-
- grab_nswindow = ((GdkWindowImplQuartz *)grab_toplevel->impl)->toplevel;
- point = [grab_nswindow convertScreenToBase:screen_point];
-
- /* Note: x_root and y_root are already right. */
- *x = point.x;
- *y = grab_toplevel->height - point.y;
+ get_window_point_from_screen_point (grab_toplevel, screen_point,
+ x, y);
return grab_toplevel;
}